package git.bankview.wl.auth;

import java.util.*;
import java.text.*;
import java.sql.*;

import laya.semi.process.*;

import git.bankview.sl.db.*;
import git.bankview.wl.common.*;
import git.bankview.wl.bean.LogonBean;
import git.bankview.sl.report.ReportCommon;
import git.bankview.sl.report.SchdUtil;

import org.apache.log4j.Logger;

public class RoleListActivity extends SqlQueryActivityBase
{
	private static Logger log = Logger.getLogger(RoleListActivity.class);
   
	protected StringBuffer buildSqlBuffer(IProcessContext oCtx)
		throws Exception
	{
		String[] vKeyword = (String[])oCtx.getField("keyword");
		StringBuffer oSql = new StringBuffer("SELECT");
		oSql.append("  roleid")		//c01
			.append(", rolelabel")	//c02
			.append(", roledesc")	//c03
			.append(", statuscode")	//c04
			.append(" FROM InfoRole WHERE 1 = 1");
		
		for (int i = 0; null != vKeyword && i < vKeyword.length; ++i)
		{
			String keyword = vKeyword[i].trim().replaceAll("'", "''");
			if (0 < keyword.length())
			{
				oSql.append(" and (roleid like '%").append(keyword).append("%'")
					.append(" or rolelabel like '%").append(keyword).append("%'")
					.append(" or roledesc like '%").append(keyword).append("%'")
					.append(")");
			}
		}
		
		return oSql;
	}
}
